package br.com.colegio.dao;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import br.com.colegio.dao.storage.Storage;

public class FinanceiroSaldoMensalDAO {/*
	public static Collection<Object> list(){
		try {
			return Storage.select(FinanceiroSaldoMensal.class.getName(),null);
		}
		catch(Exception e){
			e.printStackTrace();
		}
		return null;
	}

	public static FinanceiroSaldoMensal get(Long cod){
		try {
			Object r = Storage.get(FinanceiroSaldoMensal.class.getName(),cod);
			if(r != null) return (FinanceiroSaldoMensal)r;
		}
		catch(Exception e){
			e.printStackTrace();
		}
		return null;
	}

	public static Collection<Object> getByData(int ano, int mes){
		return getByContaAndData(null, ano, mes);
	}

	public static Collection<Object> getByContaAndData(String conta, int ano, int mes){
		try {
			String params = "String p1, String p2, String p3";
			String filter = "ano == p1 && mes == p2";

			if(conta != null) filter = " && conta = p3";

			Map<String,Object> parVal = new HashMap<String,Object>();
			parVal.put("p1",ano);
			parVal.put("p2",mes);
			parVal.put("p3",conta);

			return Storage.select(FinanceiroSaldoMensal.class.getName(),filter,params,parVal,null);
		}
		catch(Exception e){
			e.printStackTrace();
		}
		return null;
	}

	public static FinanceiroSaldoMensal save(FinanceiroSaldoMensal reg) throws Exception {
		return (FinanceiroSaldoMensal)Storage.save(reg);
	}

	public static void delete(Long reg) throws Exception {
		Storage.delete(FinanceiroSaldoMensal.class.getName(), reg);
	}*/
}
